package com.situ.ymall.controller;

import com.situ.ymall.entity.Goods;
import com.situ.ymall.quartz.QuartManager;
import com.situ.ymall.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class GoodsController {

    @Autowired
    private GoodsService goodsService;
    /*@Autowired
    private QuartManager quartManager;*/
    @GetMapping("/search")
    public String search(){
        /*quartManager.addJob();*/
        return "search";
    }
    
    @GetMapping("/goods")
    public String goods(Integer id, Model model){
        //使用同步的方法来使用数据
        //根据id查询商品的详细信息
        Goods goods = goodsService.getById(id);

        model.addAttribute("goods",goods);
        return "goods";
    }
    
}   
